// 导入模块
#include <iostream>
#include <string>
#include <thread>

#include "distributed_object.h"
#include "distributed_objectstore.h"
#include "objectstore_errors.h"

#define BUNDLENAME "bundle_test"
#define SESSIONNAME "session_test"

using namespace std;
using namespace OHOS::ObjectStore;

// 创建对象，该对象包含4个属性类型：string、number、boolean和Object

int main(int argc, char *argv[])
{
  DistributedObjectStore *objectStore = DistributedObjectStore::GetInstance(BUNDLENAME);
/*认证*/
  string sessionId="123456";
/*链接*/
    
/*创建数据库*/
  DistributedObject *object = objectStore->CreateObject(sessionId);
/*使用（增删改查）*/ 
    double doubleValue;
    bool boolValue;
    string stringValue;

    object->PutDouble("doubleTest",3.1415926);
    object->PutBoolean("boolTest",true);
    object->PutString("stringTest","this is a test");

    object->GetDouble("doubleTest", doubleValue);
    object->GetBoolean("boolTest", boolValue);
    object->GetString("stringTest",stringValue);

    cout<<doubleValue<<boolValue<<stringValue<<endl;

/*销毁*/
    objectStore->DeleteObject(sessionId);
}
